package com.ghy.service.impl;

import com.ghy.entity.EbProduct;
import com.ghy.mapper.ProductMapper;
import com.ghy.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProductServiceImpl implements ProductService{
    @Autowired
    private ProductMapper productMapper;
    @Override
    public List<EbProduct> listByPage(int page, int pageSize){
        int from = (page-1)*pageSize;
        return productMapper.findByPage(from,pageSize);
    }
    @Override
    public EbProduct select(Integer epId){
        return productMapper.select(epId);
    }
    @Override
    public int save(EbProduct ebProduct){
        return productMapper.save(ebProduct);
    }
    @Override
    public int delete(Integer epId){
        return  productMapper.remove(epId);
    }
    @Override
    public int update(EbProduct ebProduct){
        return  productMapper.updateByPrimaryKey(ebProduct);
    }
    @Override
    public Integer getMaxPage(Integer pageSize){
        return productMapper.getMaxPage(pageSize);
    }

}
